package com.aistar.hotel.controller;

import com.aistar.hotel.entity.HotelOrder;
import com.aistar.hotel.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wubin on 2019/7/3.
 */
@RestController
public class OrderHotelController {
//    private HotelOrder hotelOrder;
    @Autowired
    private RedisTemplate redisTemplate;
    @PostMapping("/orderhotel")
    public Result hotelinfo(HotelOrder hotelOrder){

     String flag = (String) redisTemplate.opsForValue().get("hotelorder"+hotelOrder);
     if (flag==null){
         redisTemplate.opsForValue().set("hotelorder"+hotelOrder,hotelOrder);
     }
        System.out.println(hotelOrder);

      Result result = new Result(true,20000,"存放成功");
      return result;
    }

}
